package com.desarrollo.microantofa;

import com.desarrollo.microantofa.R;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

public class Linea107Activity extends FragmentActivity {
	private GoogleMap mMap;
	static final CameraPosition ANTOFAGASTA =
            new CameraPosition.Builder().target(new LatLng(-23.65, -70.40))
                    .zoom(14.5f)
                    .bearing(0)
                    .tilt(0)
                    .build();
	
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mapa_antofa);
        setUpMapIfNeeded();
    }

    @Override
    protected void onResume() {
        super.onResume();
        setUpMapIfNeeded();
    }

    
    private void setUpMapIfNeeded() {
        // Do a null check to confirm that we have not already instantiated the map.
        if (mMap == null) {
            // Try to obtain the map from the SupportMapFragment.
            mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
                    .getMap();
            // Check if we were successful in obtaining the map.
            if (mMap != null) {
                setUpMap();
            }
        }
    }

    private void setUpMap() {
    	mMap.setMyLocationEnabled(true);
    	mMap.moveCamera(CameraUpdateFactory.newCameraPosition(ANTOFAGASTA));
    }
}
